#include "stdio.h"
#include "math.h"
#include "stdlib.h"
#include "mechine_offset_adj.h"

#define LOG printf
//#define LOG(...)

/*
* test
* gcc
*/

void main(void)
{
  int setv;
  int encodev;
  adj_t adj;
  
  adj_init(&adj,1000);
  
  while(1)
  {
    
    LOG("\n****************\n");
    
    LOG("adj ctrl input:c \n");
    
    if(getchar()=='c')
      
    {
      
      LOG("\nset destance:");
      
      scanf("%d",&setv);
      
      LOG("\n");
      
      LOG("\nset encodev:");
      
      scanf("%d",&encodev);
      
      LOG("\n");
      
      adj_ctrl_param(&adj, encodev, setv);
      
    }
    
    else
      
    {
      
      LOG("\nset encodev:");
      
      scanf("%d",&encodev);
      
      LOG("\n");
      
      adj_encode_value(&adj,encodev);
      
    }
    
    
    
    LOG("dir:%s\n",adj.dir==0?"left":"right");
    
    LOG("offset:%d\n",adj.offset);
    
    LOG("dest:%d\n",adj.dest);
    
    LOG("last:%d\n",adj.last);
    
    LOG("real:%d\n",adj.real);
    
    getchar();
    
  }
  
}
